From e8c2d5c38a73cc28d006371a226b62fed6c60ed9 Mon Sep 17 00:00:00 2001 From: Keir Fraser Date: Sat, 24 Nov 2007 13:27:08 +0000 Subject: [PATCH] [Mini-OS] Add init_SEMAPHORE Add init_SEMAPHORE() to dynamically initialize semaphores. Signed-off-by: Samuel Thibault --- extras/mini-os/include/semaphore.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/extras/mini-os/include/semaphore.h b/extras/mini-os/include/semaphore.h index 2c6394265e..261cd7e5da 100644 --- a/extras/mini-os/include/semaphore.h +++ b/extras/mini-os/include/semaphore.h @@ -41,12 +41,14 @@ struct rw_semaphore { #define DECLARE_MUTEX_LOCKED(name) __DECLARE_SEMAPHORE_GENERIC(name,0) -static inline void init_MUTEX(struct semaphore *sem) +static inline void init_SEMAPHORE(struct semaphore *sem, int count) { - sem->count = 1; + sem->count = count; init_waitqueue_head(&sem->wait); } +#define init_MUTEX(sem) init_SEMAPHORE(sem, 1) + static void inline down(struct semaphore *sem) { unsigned long flags; -- 2.30.2